#ifndef BITEDITOR_H
#define BITEDITOR_H

#include <QDialog>
#include <QCheckBox>
#include <QLabel>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLineEdit>

//------------------- class WidgetBit ------------------------
class WidgetBit : public QWidget
{
    Q_OBJECT

public:
    WidgetBit(QWidget * parent = 0);
    ~WidgetBit();

    QCheckBox * checkBox;
    QLabel * lblDigital;
    QLabel * lblNumBit;
    QVBoxLayout * vLayout;

    void setUnit();
    void setZero();
    void setInverse();

private slots:
    void on_checkBox_clicked();
};  //  WidgetBit

//------------------- class BitEditor ------------------------
class BitEditor : public QDialog
{
    Q_OBJECT

public:
    explicit BitEditor(int nBit = 8, QWidget *parent = 0);
    ~BitEditor();

    QPushButton * btnOK;
    QPushButton * btnOn;
    QPushButton * btnOff;
    QPushButton * btnInverse;
    QLineEdit * lineEdit;

    QString getBitsValue();
    void setBitsValue(int);

private:
    QString bitsValue;
    int n;
    QVector<WidgetBit *> widgetBit;
    QLabel * lblHex;
    QLabel * lblSignDecimal;
    QLabel * lblUnsingDecimal;

private slots:


    void on_lineEdit_textChanged(const QString&);
    void on_btnOn_clicked();
    void on_btnOff_clicked();
    void on_btnInverse_clicked();
    void getStrValue();
};  //    class BitEditor

#endif // BITEDITOR_H
